
function CreatePromise(url) {
    console.log(3);
    let p = new Promise((resolve, reject) => {
        console.log(4);
        let xhr = new XMLHttpRequest();
        xhr.open("get", url);
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    //拿到数据
                    console.log(5);
                    resolve(xhr.responseText)
                } else {
                    reject()
                }
            }
        }
        xhr.send();
    })
    console.log(6);
    return p;
}

console.log(1);
async function ajaxAll() {
    console.log(7);
    let dataA = await CretePromise("urlA");
    console.log(9);
    let dataB = await CretePromise("urlB");
    console.log(8);
}
ajaxAll();
console.log(2);